<html>
<head><meta charset="utf-8"><title>Cancellation of other side disappearing · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html">Cancellation of other side disappearing</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235843707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235843707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zeeshan Ali <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235843707">(Apr 23 2021 at 13:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Still trying to understand what you meant by "other side disappearing" in today's meeting. Is the issue that your future stick around until it's polled again (which is when you get the error and future is complete) and that could potentially be a very long time?</p>



<a name="235845628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235845628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235845628">(Apr 23 2021 at 14:05)</a>:</h4>
<p>I think the chat is a good example</p>



<a name="235845649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235845649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235845649">(Apr 23 2021 at 14:05)</a>:</h4>
<p>If I am chatting with someone and they close their connection</p>



<a name="235845681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235845681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235845681">(Apr 23 2021 at 14:05)</a>:</h4>
<p>the "other side" has disappeared</p>



<a name="235845704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235845704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235845704">(Apr 23 2021 at 14:05)</a>:</h4>
<p>another would be:</p>



<a name="235845761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235845761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235845761">(Apr 23 2021 at 14:05)</a>:</h4>
<p>if I am preparing the result for some HTTP request and the connection is closed</p>



<a name="235847220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235847220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zeeshan Ali <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235847220">(Apr 23 2021 at 14:14)</a>:</h4>
<p>right so the issue is that you'd like to be notified as soon as other side disappears and not end up doing a lot of processing for no reason?</p>



<a name="235855137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855137">(Apr 23 2021 at 15:01)</a>:</h4>
<p><span class="user-mention" data-user-id="400241">@Zeeshan Ali</span> in general, yes, but i imagine you might not want your code to die <em>right away</em></p>



<a name="235855153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855153">(Apr 23 2021 at 15:01)</a>:</h4>
<p>this is kind of the caching example</p>



<a name="235855203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855203">(Apr 23 2021 at 15:01)</a>:</h4>
<p>I think lock poisoning is another good example</p>



<a name="235855316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855316">(Apr 23 2021 at 15:02)</a>:</h4>
<p>the reason we <em>have</em> lock poisoning is because if there is a panic while I hold the mutex</p>



<a name="235855345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855345">(Apr 23 2021 at 15:02)</a>:</h4>
<p>chances are that I left things in an incomplete state</p>



<a name="235855371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855371">(Apr 23 2021 at 15:02)</a>:</h4>
<p>and the next person to acquire the mutex wants to propagate that panic</p>



<a name="235855410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855410">(Apr 23 2021 at 15:02)</a>:</h4>
<p>(this was the design, at least)</p>



<a name="235855439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855439">(Apr 23 2021 at 15:02)</a>:</h4>
<p>try to tear down all the things related to that broken state</p>



<a name="235855491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855491">(Apr 23 2021 at 15:02)</a>:</h4>
<p>in an async context, though, you need a way to <em>guard against that</em></p>



<a name="235855529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855529">(Apr 23 2021 at 15:02)</a>:</h4>
<p>e.g., if I hold an async mutex and I am doing stuff in it</p>



<a name="235855565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855565">(Apr 23 2021 at 15:02)</a>:</h4>
<p>and then I get canceled part way through at some await point</p>



<a name="235855612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855612">(Apr 23 2021 at 15:03)</a>:</h4>
<p>what happens to the next person who acquires that mutex?</p>



<a name="235855678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855678">(Apr 23 2021 at 15:03)</a>:</h4>
<p>either they panic, or else they see broken data</p>



<a name="235855746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855746">(Apr 23 2021 at 15:03)</a>:</h4>
<p>might be better if. could say "while i'm holding this async mutex, plese don't cancel me"</p>



<a name="235855856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855856">(Apr 23 2021 at 15:03)</a>:</h4>
<p>(or, more to the point, if the <em>async mutex</em> could say that)</p>



<a name="235855894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235855894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235855894">(Apr 23 2021 at 15:03)</a>:</h4>
<p>(synchronous drop makes that hard, of course)</p>



<a name="235860889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Cancellation%20of%20other%20side%20disappearing/near/235860889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zeeshan Ali <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Cancellation.20of.20other.20side.20disappearing.html#235860889">(Apr 23 2021 at 15:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> thanks for explaining. I think I misunderstood "the other side" as something completely external to the system. Now it makes more sense. :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>